//
//  MenuMainModel.m
//  Products_B
//
//  Created by lanou on 16/5/28.
//  Copyright © 2016年 朋学友. All rights reserved.
//

#import "MenuMainModel.h"

@implementation MenuMainModel
+ (NSMutableDictionary *)modelConfigureWithDic:(NSDictionary *)jsonDic{
    
    NSArray *widgetList = jsonDic[@"data"][@"widgetList"];
    NSMutableDictionary *modelDic = [NSMutableDictionary dictionary];
    for (int i = 2; i < widgetList.count; i++) {
        NSString *key = widgetList[i][@"title"];
        
      
        NSNumber *widget_id = widgetList[i][@"widget_id"];
         NSMutableArray *modelArray = [NSMutableArray array];
        if ([widget_id integerValue] == 38) {
            continue;
        }
//        if ([key isEqualToString:@"全部场景(126)"]) {
////            [modelDic setObject:[@[]mutableCopy] forKey:key];
//            continue;
//        }
        for (NSDictionary *widget_dataDic in widgetList[i][@"widget_data"]) {
            
        MenuMainModel *model = [[self alloc]init];
        [model setValuesForKeysWithDictionary:widget_dataDic];
        [modelArray addObject:model];
    }
        
        [modelDic setObject:modelArray forKey:key];
    }
        return modelDic;
}

+ (NSMutableArray *)modelConfigureDic:(NSDictionary *)jsonDic{
     NSArray *widgetList = jsonDic[@"data"][@"widgetList"];
    NSMutableArray *modelArray = [NSMutableArray array];
    
    for (int i = 2; i < widgetList.count; i++) {
        [modelArray addObject:widgetList[i][@"desc"] ];
    }
    return modelArray;
}
+ (NSMutableArray *)modelKeyConfigureDic:(NSDictionary *)jsonDic{
    NSArray *widgetList = jsonDic[@"data"][@"widgetList"];
    NSMutableArray *modelArray = [NSMutableArray array];
    for (int i = 2; i < widgetList.count; i++) {
        if (widgetList[i][@"title"] == nil || [widgetList[i][@"title"] isEqualToString:@""]) {
            [modelArray addObject:@""];
        }
        [modelArray addObject:widgetList[i][@"title"] ];
    }
    return modelArray;
}
+ (NSMutableArray *)modelLinkConfigureDic:(NSDictionary *)jsonDic{
    NSArray *widgetList = jsonDic[@"data"][@"widgetList"];
    NSMutableArray *modelArray = [NSMutableArray array];
    
    
    //  一下是5  一下是6   去你妹
    for (int i = 2; i < 5; i++) {
        if (widgetList[i][@"title_link"] == nil || [widgetList[i][@"title_link"] isEqualToString:@""]) {
            [modelArray addObject:@""];
        }
        
        
      NSArray *array =  [widgetList[i][@"title_link"] componentsSeparatedByString:@"#"];
        [modelArray addObject:array[1] ];
    }
    return modelArray;

}
@end
